package com.lzh.template.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.lzh.template.common.BaseEntity;
import com.lzh.template.model.dto.chart.AddChartDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 图表实体类
 *
 * @author luzhiheng
 * @since 2023-12-28 16:14:28
 */
@EqualsAndHashCode(callSuper = true)
@SuppressWarnings("serial")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("lzh_chart")
@Entity
@Table(name = "lzh_chart", indexes = {})
public class ChartEntity extends BaseEntity {

    /**
     * 图表名称
     */
    @Column(name = "name", columnDefinition = "varchar(128) COMMENT '图表名称'")
    private String name;

    /**
     * 分析目标
     */
    @Column(name = "goal", columnDefinition = "text COMMENT '分析目标'")
    private String goal;

    /**
     * 图表数据
     */
    @Column(name = "chart_data", columnDefinition = "text COMMENT '图表数据'")
    private String chartData;

    /**
     * 图表类型
     */
    @Column(name = "chart_type", columnDefinition = "varchar(128) COMMENT '图表类型'")
    private String chartType;

    /**
     * 生成的图表数据
     */
    @Column(name = "gen_chart", columnDefinition = "text COMMENT '生成的图表数据'")
    private String genChart;

    /**
     * 生成的分析结论
     */
    @Column(name = "gen_result", columnDefinition = "text COMMENT '生成的图表数据'")
    private String genResult;

    public ChartEntity(AddChartDto dto) {
        this.chartData = dto.getChartData();
        this.chartType = dto.getChartType();
        this.goal = dto.getGoal();
    }
}
